﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Business.Compta;

namespace DAO
{
    public class IComptaLineNotifier
    {
        public delegate void ChangedEventHandler(object sender, NotifyEventArgs e);

        public event ChangedEventHandler Changed;
        public event ChangedEventHandler Begin;
        public event ChangedEventHandler Ended;

        protected virtual void OnChanged(NotifyEventArgs e)
        {
            if (Changed != null)
                Changed(this, e);
        }
        protected virtual void OnBegin(NotifyEventArgs e)
        {
            if (Begin != null)
                Begin(this, e);
        }
        protected virtual void OnEnded(NotifyEventArgs e)
        {
            if (Ended != null)
                Ended(this, e);
        }
    }



    public class NotifyEventArgs : EventArgs
    {

       public enum UpdateEnum { Add, Del, Modify };
       private UpdateEnum update;
       public UpdateEnum Update
       {
           get
           {
               return this.update;
           }
       }

        private int advancement;
        public int Advancement
        {
            get
            {
                return this.advancement;
            }
        }

        private ComptaLine line;
        public ComptaLine Line
        {
            get
            {
                return this.line;
            }
        }

        private string message;
        public string Message
        {
            get
            {
                return this.message;
            }
        }

        public NotifyEventArgs(int advancement, String message, ComptaLine line, UpdateEnum updateEnum)
        {
            this.advancement = advancement;
            this.message = message;
            this.line = line;
            this.update = updateEnum;
        }
    }
}
